package _7_io_socket_http.io;



/**
 * Created by bpzj on 5/30/2018.
 */
public class ResultVO<T> {
    private Integer code;

    private String message;

    private T data;

    public ResultVO<T> success() {
        this.setCode(200);
        this.setMessage("success");
        return this;
    }

    public ResultVO<T> success(String message) {
        this.setCode(200);
        this.setMessage(message);
        return this;
    }

    public ResultVO<T> failure(String error) {
        this.setCode(100);
        this.setMessage(error);
        return this;
    }

    public ResultVO<T> failure() {
        this.setCode(100);
        this.setMessage("failure");
        return this;
    }

    public ResultVO<T> putData(T data) {
        this.setData(data);
        return this;
    }

    // ************** 构造器 *********************
    public ResultVO() {
    }

    public ResultVO(T data) {
        this.data = data;
    }

    // **************** Getter and Setter **************

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

}
